package com.fifth.apartment.controller;


import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.fifth.apartment.result.Results;
import com.fifth.apartment.service.RoomInfoService;
import com.fifth.apartment.vo.room.RoomItemVo;
import com.fifth.apartment.vo.room.RoomQueryVo;
import io.swagger.annotations.Api;


import io.swagger.v3.oas.annotations.Operation;

import io.swagger.v3.oas.annotations.tags.Tag;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

@Tag(name = "房间信息管理")
@Api(tags = "房间接口")
@RestController
@RequestMapping("/admin/room")
public class RoomController {
    @Autowired
    private RoomInfoService roomInfoService;

//    @Operation(summary = "保存或更新房间信息")
//    @PostMapping("saveOrUpdate")
//    public Results saveOrUpdate(@RequestBody RoomSubmitVo roomSubmitVo) {
//        roomInfoService.saveOrUpdateRoom(roomSubmitVo);
//        return Results.ok();
//    }

    @Operation(summary = "根据条件分页查询房间列表")
    @GetMapping("pageItem")
    public Results<IPage<RoomItemVo>> pageItem(@RequestParam long current, @RequestParam long size, RoomQueryVo queryVo) {
        IPage<RoomItemVo> page = new Page<>(current,size);
        IPage<RoomItemVo> result = roomInfoService.pageRoomItemByQuery(page,queryVo);

        return Results.ok(result);
    }

//    @Operation(summary = "根据id获取房间详细信息")
//    @GetMapping("getDetailById")
//    public Results<RoomDetailVo> getDetailById(@RequestParam Long id) {
//        RoomDetailVo roomDetailVo = roomInfoService.getRoomDetailById(id);
//        return Results.ok(roomDetailVo);
//    }

//    @Operation(summary = "根据id删除房间信息")
//    @DeleteMapping("removeById")
//    public Results removeById(@RequestParam Long id) {
//        roomInfoService.removeRoomById(id);
//        return Results.ok();
//    }

//    @Operation(summary = "根据id修改房间发布状态")
//    @PostMapping("updateReleaseStatusById")
//    public Results updateReleaseStatusById(Long id, String status) {
//        LambdaUpdateWrapper<RoomInfo> updateWrapper = new LambdaUpdateWrapper<>();
//        updateWrapper.eq(RoomInfo::getId,id);
//        updateWrapper.set(RoomInfo::getIsRelease,status);
//        roomInfoService.update(updateWrapper);
//
//        return Results.ok();
//    }

//    @GetMapping("listBasicByApartmentId")
//    @Operation(summary = "根据公寓id查询房间列表")
//    public Results<List<RoomInfo>> listBasicByApartmentId(Long id) {
//        LambdaQueryWrapper<RoomInfo> queryWrapper = new LambdaQueryWrapper<>();
//        queryWrapper.eq(RoomInfo::getId,id);
//        List<RoomInfo> list = roomInfoService.list();
//        return Results.ok(list);
//    }

}


















